import { createStore, applyMiddleware, compose } from 'redux'
import promiseMiddleware from 'redux-promise'
import rootReducer from './reducers'
const devTools = require('../libs/remote-redux-devtools.js').default

// devTools开关
const isdevTools = false
let reduxDev
if (isdevTools) {
  reduxDev = compose(devTools({
    hostname: '172.18.70.56', // 手机调试时,此处改为自己的ip
    port: 5678,
    secure: false
  }))
} else {
  reduxDev = {}
}

export default function configStore () {
  const store = createStore(rootReducer, reduxDev, applyMiddleware(promiseMiddleware))
  return store
}
